import http from '../../utils/request'
import type { ArticleInfo, queryArticleInfo } from '../ApiType/article'
/**
 * @description 添加文章
 * @param data
 */
export function addArticle(data: ArticleInfo) {
  return http.post('/api/addArticle', data)
}
/**
 * @description 编辑文章
 * @param data
 */
export function editArticle(data: ArticleInfo) {
  return http.post('/api/editArticle', data)
}
/**
 * @description 查询所有文章列表 
 * @param data  page 页码  pageSize  页面条数
 */
export function queryArticleList(data: queryArticleInfo) {
  return http.get('/api/queryArticleList', data)
}
/**
 * @description 查询文章详情
 * @param data id  文章唯一标识
 */
export function queryArticleDetail(id: string | number) {
  return http.post(`/api/articleDetail?id=${id}`)
}

/**
 * @description 删除文章
 * @param data id  文章唯一标识
 */
export function deleteArticle(id: string | number) {
  return http.delete(`/api/deleteArticle/${id}`)
}